package com.herench.bs.handler;

import com.herench.bs.agent.IPersonAgent;
import com.herench.bs.annotation.Handler;
import com.herench.bs.support.AbstractMessageHandler;
import com.herench.bs.support.RequestMessage;
import com.herench.bs.support.ResponseMessage;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * Created by ThinkPad on 2018/3/14.
 */

@Component
@Handler(code = "101105" ,name="导诊-病症列表加载")
public class DzSymptomHandler extends AbstractMessageHandler {

    @Override
    protected ResponseMessage innerHandler(RequestMessage requestMessage) throws Exception {
        ResponseMessage responseMessage = new ResponseMessage(requestMessage.getId());
        String channelCode = requestMessage.getArgsPropertyStringValue("sysCode");
        String partId= requestMessage.getArgsPropertyStringValue("partId");
        String hospitalCode = getCleverClinicContext().getHospitalCodeByChannelCode(channelCode);
        IPersonAgent agent = getCleverClinicContext().getApplicationContext().getBean(IPersonAgent.class);
        Map<String,Object> res = agent.loadSymptomData(channelCode,hospitalCode,partId);
        responseMessage.setData(res);
        getPropertiesFromInvokerResultMap(responseMessage,res);
        return responseMessage;
    }
}
